#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template<class T> using oset =tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update> ;
#define fast_io \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define ll long long
#define ld long double
#define mod 1000000007
#define inf 1e9
#define endl '\n'
static bool comp(const pair<int, int>& p1, const pair<int, int>& p2){
if(p1.first!=p2.first){
return p1.first<p2.first;
}else{
return p1.second>p2.second;
}
}
void solve(){
int n, k; cin>>n>>k;
vector<int> a(n);
for(int i=0; i<n; i++) cin>>a[i];
int lastInd = n-1;
k = min(k, n);
for(int j=0; j<k; j++){
if(a[lastInd] > n){
cout << "NO" << endl;
return;
}
lastInd -= a[lastInd];
if(lastInd < 0){
lastInd += n;
}
}
cout << "YES" << endl;
}
int main(){
fast_io;
cout << fixed;
cout << setprecision(10);
int t;
t=1;
cin>>t;
while(t--)
{
solve();
}
}
433A - Kitahara Haruki's Gift | 672A - Summer Camp |
1277A - Happy Birthday Polycarp | 577A - Multiplication Table |
817C - Really Big Numbers | 1355A - Sequence with Digits |
977B - Two-gram | 993A - Two Squares |
1659D - Reverse Sort Sum | 1659A - Red Versus Blue |
1659B - Bit Flipping | 1480B - The Great Hero |
1519B - The Cake Is a Lie | 1659C - Line Empire |
515A - Drazil and Date | 1084B - Kvass and the Fair Nut |
1101A - Minimum Integer | 985D - Sand Fortress |
1279A - New Year Garland | 1279B - Verse For Santa |
202A - LLPS | 978A - Remove Duplicates |
1304A - Two Rabbits | 225A - Dice Tower |
1660D - Maximum Product Strikes Back | 1513A - Array and Peaks |
1251B - Binary Palindromes | 768B - Code For 1 |
363B - Fence | 991B - Getting an A |